package com.yugao.fintech.draper.log.config;

import com.yugao.fintech.draper.auth.api.LogFeignApi;
import com.yugao.fintech.draper.log.service.AsyncLogService;
import com.yugao.fintech.draper.log.aspect.WebLogAspect;
import com.yugao.fintech.draper.log.event.AsyncLogListener;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;

@EnableAsync
@AutoConfiguration
public class LogAutoConfig {

	@Bean
	public AsyncLogService asyncLogService(LogFeignApi logFeignApi) {
		return new AsyncLogService(logFeignApi);
	}

	@Bean
	public WebLogAspect webLogAspect(AsyncLogService asyncLogService) {
		return new WebLogAspect(asyncLogService);
	}

	@Bean
	public AsyncLogListener asyncLogListener(AsyncLogService asyncLogService) {
		return new AsyncLogListener(asyncLogService);
	}
}
